Skip to main content

All Questions

1vote
1answer
140views

Transform an array into object and set index for an unique key in javascript

I have a method that merges keys and indexes from an array into an object. I'm stuck with ways to compress this method, and I don't know what I can do to make it simpler. Goal get an array of objects ...
wittgenstein's user avatar
10votes
3answers
764views

JavaScript OOD: 2048

I wrote a 2048 game in JavaScript with an object-oriented paradigm. The game board is presented with a two-dimensional array and each tile holds an integer. Here is the implementation: ...
Joji's user avatar
  • 325
1vote
1answer
105views

JavaScript, looping, and functional approach

Data Structure coming back from the server ...
FNMT8L9IN82's user avatar
1vote
1answer
53views

converting object of arrays to an array of objects in a desired format

...
Vignesh Sharma's user avatar
0votes
1answer
78views

Functional vs Object Oriented Approach for UI codes

I have the following snippets. which formats error messages based on a map. I can do it as a simple function call the function for transforming the error. or create a class and handle it in that way. ...
Sreevisakh's user avatar
2votes
1answer
554views

Constructor function for persons with hobbies

I'm trying to write a constructor function that generates instances of a user. One of the properties of the user class is an array of the user's hobbies. I'd like ...
Anthony's user avatar
1vote
0answers
497views

Fetching weather data from API

I was experimenting with some code to fetch the current weather data as well as getting the hourly forecast. I could have done ...
CodeYogi's user avatar
1vote
1answer
76views

Concat strings from Object or Array

How would you merge these two functions into a single more generic function? ...
jdsninja's user avatar
3votes
1answer
90views

Stock performance app

I'm building an app that tells you a stock's percentage change in price between two dates by using Yahoo's API. Given a stock ticker and two dates, it currently outputs the percentage return to the ...
Jackmc1047's user avatar
33votes
6answers
3kviews

To 'this' or not to 'this'?

I was given a homework and I have 2 solutions: one that uses this and other one that doesn't. I tested both solutions on jsPerf but sometimes it says the version ...
Rahul Desai's user avatar
3votes
1answer
203views

The eternal dilemma: bar.foo() or foo(bar)?

I was using foo(bar) as it's adopted for functional programming. ...
MaiaVictor's user avatar

close